.class Lcom/android/inputmethod/latin/VlingoVoiceManager;
.super Lcom/android/inputmethod/latin/VoiceKeyboardManager;
.source "VlingoVoiceManager.java"


# static fields
.field static final DEBUG:Z = false

.field static final TAG:Ljava/lang/String; = "###### VlingoVoiceManager ######"

.field private static mInstance:Lcom/android/inputmethod/latin/VlingoVoiceManager;


# instance fields
.field private mAnimationView:Landroid/widget/ImageView;

.field mButton:Landroid/widget/Button;

.field mButtonOnClickListener:Landroid/view/View$OnClickListener;

.field private mConnection:Landroid/content/ServiceConnection;

.field mIsListening:Z

.field mService:Lcom/vlingo/client/asr/service/IVLRecognitionService;

.field mStatusMsgView:Landroid/widget/TextView;

.field m_recListener:Lcom/vlingo/client/asr/service/IVLRecognitionListener;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 47
    const/4 v0, 0x0

    sput-object v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mInstance:Lcom/android/inputmethod/latin/VlingoVoiceManager;

    return-void
.end method

.method private constructor <init>(Lcom/android/inputmethod/latin/LatinIME;I)V
    .locals 2
    .parameter "context"
    .parameter "engineId"

    .prologue
    const/4 v1, 0x0

    .line 86
    invoke-direct {p0, p1, p2}, Lcom/android/inputmethod/latin/VoiceKeyboardManager;-><init>(Lcom/android/inputmethod/latin/LatinIME;I)V

    .line 48
    iput-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mService:Lcom/vlingo/client/asr/service/IVLRecognitionService;

    .line 49
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mIsListening:Z

    .line 50
    iput-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButton:Landroid/widget/Button;

    .line 51
    new-instance v0, Lcom/android/inputmethod/latin/VlingoVoiceManager$1;

    invoke-direct {v0, p0}, Lcom/android/inputmethod/latin/VlingoVoiceManager$1;-><init>(Lcom/android/inputmethod/latin/VlingoVoiceManager;)V

    iput-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButtonOnClickListener:Landroid/view/View$OnClickListener;

    .line 249
    new-instance v0, Lcom/android/inputmethod/latin/VlingoVoiceManager$3;

    invoke-direct {v0, p0}, Lcom/android/inputmethod/latin/VlingoVoiceManager$3;-><init>(Lcom/android/inputmethod/latin/VlingoVoiceManager;)V

    iput-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mConnection:Landroid/content/ServiceConnection;

    .line 260
    new-instance v0, Lcom/android/inputmethod/latin/VlingoVoiceManager$4;

    invoke-direct {v0, p0}, Lcom/android/inputmethod/latin/VlingoVoiceManager$4;-><init>(Lcom/android/inputmethod/latin/VlingoVoiceManager;)V

    iput-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->m_recListener:Lcom/vlingo/client/asr/service/IVLRecognitionListener;

    .line 87
    return-void
.end method

.method static synthetic access$000(Lcom/android/inputmethod/latin/VlingoVoiceManager;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 44
    invoke-direct {p0}, Lcom/android/inputmethod/latin/VlingoVoiceManager;->setThinking()V

    return-void
.end method

.method static synthetic access$100(Lcom/android/inputmethod/latin/VlingoVoiceManager;)Landroid/widget/ImageView;
    .locals 1
    .parameter "x0"

    .prologue
    .line 44
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mAnimationView:Landroid/widget/ImageView;

    return-object v0
.end method

.method static synthetic access$200(Lcom/android/inputmethod/latin/VlingoVoiceManager;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 44
    invoke-direct {p0}, Lcom/android/inputmethod/latin/VlingoVoiceManager;->setListening()V

    return-void
.end method

.method public static getInstance(Lcom/android/inputmethod/latin/LatinIME;)Lcom/android/inputmethod/latin/VlingoVoiceManager;
    .locals 2
    .parameter "context"

    .prologue
    .line 72
    sget-object v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mInstance:Lcom/android/inputmethod/latin/VlingoVoiceManager;

    if-nez v0, :cond_0

    .line 73
    new-instance v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1}, Lcom/android/inputmethod/latin/VlingoVoiceManager;-><init>(Lcom/android/inputmethod/latin/LatinIME;I)V

    sput-object v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mInstance:Lcom/android/inputmethod/latin/VlingoVoiceManager;

    .line 82
    :goto_0
    sget-object v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mInstance:Lcom/android/inputmethod/latin/VlingoVoiceManager;

    return-object v0

    .line 75
    :cond_0
    sget-object v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mInstance:Lcom/android/inputmethod/latin/VlingoVoiceManager;

    iget-object v0, v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    if-nez v0, :cond_1

    sget-object v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mInstance:Lcom/android/inputmethod/latin/VlingoVoiceManager;

    iget-object v0, v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mService:Lcom/vlingo/client/asr/service/IVLRecognitionService;

    if-eqz v0, :cond_2

    .line 76
    :cond_1
    const-string v0, "###### VlingoVoiceManager ######"

    const-string v1, "Global instance is reused by onFinish() was not called in last usage!!"

    invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 77
    sget-object v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mInstance:Lcom/android/inputmethod/latin/VlingoVoiceManager;

    invoke-virtual {v0}, Lcom/android/inputmethod/latin/VlingoVoiceManager;->onFinish()V

    .line 79
    :cond_2
    sget-object v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mInstance:Lcom/android/inputmethod/latin/VlingoVoiceManager;

    iput-object p0, v0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    goto :goto_0
.end method

.method private setInitializing()V
    .locals 2

    .prologue
    .line 196
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mStatusMsgView:Landroid/widget/TextView;

    const-string v1, "Getting ready..."

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 197
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButton:Landroid/widget/Button;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/widget/Button;->setEnabled(Z)V

    .line 198
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButton:Landroid/widget/Button;

    const-string v1, "Cancel"

    invoke-virtual {v0, v1}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    .line 199
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mAnimationView:Landroid/widget/ImageView;

    const v1, 0x7f020015

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 200
    return-void
.end method

.method private setListening()V
    .locals 4

    .prologue
    const/4 v3, 0x1

    .line 206
    iget-boolean v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mIsVoiceKeyboardShown:Z

    if-eqz v1, :cond_0

    .line 207
    iget-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mAnimationView:Landroid/widget/ImageView;

    const v2, 0x7f02002a

    invoke-virtual {v1, v2}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 208
    iget-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mAnimationView:Landroid/widget/ImageView;

    invoke-virtual {v1}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

    move-result-object v0

    check-cast v0, Landroid/graphics/drawable/AnimationDrawable;

    .line 209
    .local v0, anim:Landroid/graphics/drawable/AnimationDrawable;
    invoke-virtual {v0}, Landroid/graphics/drawable/AnimationDrawable;->start()V

    .line 210
    iget-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButton:Landroid/widget/Button;

    invoke-virtual {v1, v3}, Landroid/widget/Button;->setEnabled(Z)V

    .line 211
    iget-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButton:Landroid/widget/Button;

    const-string v2, "Done"

    invoke-virtual {v1, v2}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    .line 212
    iput-boolean v3, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mIsListening:Z

    .line 214
    .end local v0           #anim:Landroid/graphics/drawable/AnimationDrawable;
    :cond_0
    return-void
.end method

.method private setThinking()V
    .locals 3

    .prologue
    .line 220
    iget-boolean v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mIsVoiceKeyboardShown:Z

    if-eqz v1, :cond_0

    .line 221
    iget-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mAnimationView:Landroid/widget/ImageView;

    const v2, 0x7f02005a

    invoke-virtual {v1, v2}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 222
    iget-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mAnimationView:Landroid/widget/ImageView;

    invoke-virtual {v1}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

    move-result-object v0

    check-cast v0, Landroid/graphics/drawable/AnimationDrawable;

    .line 223
    .local v0, anim:Landroid/graphics/drawable/AnimationDrawable;
    invoke-virtual {v0}, Landroid/graphics/drawable/AnimationDrawable;->start()V

    .line 224
    iget-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButton:Landroid/widget/Button;

    const-string v2, "Cancel"

    invoke-virtual {v1, v2}, Landroid/widget/Button;->setText(Ljava/lang/CharSequence;)V

    .line 226
    .end local v0           #anim:Landroid/graphics/drawable/AnimationDrawable;
    :cond_0
    return-void
.end method


# virtual methods
.method public createVoiceKeyboardView()Landroid/view/View;
    .locals 8

    .prologue
    .line 94
    iget-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    const v6, 0x7f030007

    const/4 v7, 0x0

    invoke-static {v5, v6, v7}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v4

    check-cast v4, Landroid/widget/LinearLayout;

    .line 95
    .local v4, voiceKeyboardView:Landroid/widget/LinearLayout;
    const v5, 0x7f0b000c

    invoke-virtual {v4, v5}, Landroid/widget/LinearLayout;->findViewById(I)Landroid/view/View;

    move-result-object v5

    check-cast v5, Landroid/widget/TextView;

    iput-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mStatusMsgView:Landroid/widget/TextView;

    .line 96
    const v5, 0x7f0b000d

    invoke-virtual {v4, v5}, Landroid/widget/LinearLayout;->findViewById(I)Landroid/view/View;

    move-result-object v5

    check-cast v5, Landroid/widget/ImageView;

    iput-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mAnimationView:Landroid/widget/ImageView;

    .line 97
    const v5, 0x7f0b000e

    invoke-virtual {v4, v5}, Landroid/widget/LinearLayout;->findViewById(I)Landroid/view/View;

    move-result-object v5

    check-cast v5, Landroid/widget/Button;

    iput-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButton:Landroid/widget/Button;

    .line 98
    iget-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButton:Landroid/widget/Button;

    iget-object v6, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButtonOnClickListener:Landroid/view/View$OnClickListener;

    invoke-virtual {v5, v6}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 100
    iget-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    invoke-virtual {v5}, Lcom/android/inputmethod/latin/LatinIME;->getWindow()Landroid/app/Dialog;

    move-result-object v5

    const v6, 0x102001e

    invoke-virtual {v5, v6}, Landroid/app/Dialog;->findViewById(I)Landroid/view/View;

    move-result-object v5

    check-cast v5, Landroid/widget/FrameLayout;

    const/4 v6, 0x0

    invoke-virtual {v5, v6}, Landroid/widget/FrameLayout;->getChildAt(I)Landroid/view/View;

    move-result-object v2

    .line 101
    .local v2, keyboardView:Landroid/view/View;
    if-eqz v2, :cond_0

    .line 102
    const v5, 0x7f0b000b

    invoke-virtual {v4, v5}, Landroid/widget/LinearLayout;->findViewById(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Landroid/widget/LinearLayout;

    .line 103
    .local v3, progressContainer:Landroid/widget/LinearLayout;
    iget-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    invoke-virtual {v5}, Lcom/android/inputmethod/latin/LatinIME;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    const v6, 0x7f090005

    invoke-virtual {v5, v6}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

    move-result v0

    .line 104
    .local v0, buttonHeight:I
    invoke-virtual {v2}, Landroid/view/View;->getHeight()I

    move-result v5

    mul-int/lit8 v6, v0, 0x2

    sub-int v1, v5, v6

    .line 105
    .local v1, height:I
    new-instance v5, Landroid/widget/LinearLayout$LayoutParams;

    const/4 v6, -0x1

    invoke-direct {v5, v6, v1}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V

    invoke-virtual {v3, v5}, Landroid/widget/LinearLayout;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 108
    .end local v0           #buttonHeight:I
    .end local v1           #height:I
    .end local v3           #progressContainer:Landroid/widget/LinearLayout;
    :cond_0
    return-object v4
.end method

.method public onCancel()V
    .locals 2

    .prologue
    .line 167
    invoke-super {p0}, Lcom/android/inputmethod/latin/VoiceKeyboardManager;->onCancel()V

    .line 168
    iget-boolean v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mIsErrorMessageShown:Z

    if-eqz v0, :cond_1

    .line 169
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mHideErrorMessageRunnable:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 170
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mIsErrorMessageShown:Z

    .line 176
    :cond_0
    :goto_0
    return-void

    .line 172
    :cond_1
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mService:Lcom/vlingo/client/asr/service/IVLRecognitionService;

    if-eqz v0, :cond_0

    .line 173
    :try_start_0
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mService:Lcom/vlingo/client/asr/service/IVLRecognitionService;

    invoke-interface {v0}, Lcom/vlingo/client/asr/service/IVLRecognitionService;->cancel()V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public onFinish()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 180
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mService:Lcom/vlingo/client/asr/service/IVLRecognitionService;

    if-eqz v0, :cond_0

    .line 181
    :try_start_0
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mService:Lcom/vlingo/client/asr/service/IVLRecognitionService;

    invoke-interface {v0}, Lcom/vlingo/client/asr/service/IVLRecognitionService;->cancel()V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    .line 182
    :goto_0
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    iget-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mConnection:Landroid/content/ServiceConnection;

    invoke-virtual {v0, v1}, Lcom/android/inputmethod/latin/LatinIME;->unbindService(Landroid/content/ServiceConnection;)V

    .line 183
    iput-object v2, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mService:Lcom/vlingo/client/asr/service/IVLRecognitionService;

    .line 185
    :cond_0
    iput-object v2, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mStatusMsgView:Landroid/widget/TextView;

    .line 186
    iput-object v2, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mAnimationView:Landroid/widget/ImageView;

    .line 187
    iput-object v2, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mButton:Landroid/widget/Button;

    .line 188
    invoke-super {p0}, Lcom/android/inputmethod/latin/VoiceKeyboardManager;->onFinish()V

    .line 189
    return-void

    .line 181
    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public showErrorMessage(Ljava/lang/String;)V
    .locals 4
    .parameter "msg"

    .prologue
    .line 234
    iget-boolean v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mIsVoiceKeyboardShown:Z

    if-eqz v0, :cond_0

    .line 235
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mHandler:Landroid/os/Handler;

    new-instance v1, Lcom/android/inputmethod/latin/VlingoVoiceManager$2;

    invoke-direct {v1, p0, p1}, Lcom/android/inputmethod/latin/VlingoVoiceManager$2;-><init>(Lcom/android/inputmethod/latin/VlingoVoiceManager;Ljava/lang/String;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 245
    iget-object v0, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mHideErrorMessageRunnable:Ljava/lang/Runnable;

    const-wide/16 v2, 0x7d0

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 247
    :cond_0
    return-void
.end method

.method public startRecognition()V
    .locals 9

    .prologue
    const-string v8, "com.vlingo.client.actions.RECOGNIZE"

    .line 116
    iget-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mService:Lcom/vlingo/client/asr/service/IVLRecognitionService;

    if-nez v5, :cond_1

    .line 118
    iget-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    new-instance v6, Landroid/content/Intent;

    const-string v7, "com.vlingo.client.actions.RECOGNIZE"

    invoke-direct {v6, v8}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    iget-object v7, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mConnection:Landroid/content/ServiceConnection;

    const/4 v8, 0x1

    invoke-virtual {v5, v6, v7, v8}, Lcom/android/inputmethod/latin/LatinIME;->bindService(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z

    move-result v5

    if-nez v5, :cond_0

    .line 123
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/VlingoVoiceManager;->showVoiceKeyboard()V

    .line 124
    const-string v5, "Vlingo service unavailable!"

    invoke-virtual {p0, v5}, Lcom/android/inputmethod/latin/VlingoVoiceManager;->showErrorMessage(Ljava/lang/String;)V

    .line 163
    :cond_0
    :goto_0
    return-void

    .line 128
    :cond_1
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/VlingoVoiceManager;->showVoiceKeyboard()V

    .line 129
    invoke-direct {p0}, Lcom/android/inputmethod/latin/VlingoVoiceManager;->setInitializing()V

    .line 131
    new-instance v2, Landroid/content/Intent;

    const-string v5, "com.vlingo.client.actions.RECOGNIZE"

    invoke-direct {v2, v8}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 132
    .local v2, i:Landroid/content/Intent;
    iget-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    invoke-virtual {v5}, Lcom/android/inputmethod/latin/LatinIME;->getCurrentInputEditorInfo()Landroid/view/inputmethod/EditorInfo;

    move-result-object v5

    iget-object v3, v5, Landroid/view/inputmethod/EditorInfo;->packageName:Ljava/lang/String;

    .line 133
    .local v3, packageName:Ljava/lang/String;
    iget-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    invoke-virtual {v5}, Lcom/android/inputmethod/latin/LatinIME;->getCurrentInputConnection()Landroid/view/inputmethod/InputConnection;

    move-result-object v5

    new-instance v6, Landroid/view/inputmethod/ExtractedTextRequest;

    invoke-direct {v6}, Landroid/view/inputmethod/ExtractedTextRequest;-><init>()V

    const/4 v7, 0x0

    invoke-interface {v5, v6, v7}, Landroid/view/inputmethod/InputConnection;->getExtractedText(Landroid/view/inputmethod/ExtractedTextRequest;I)Landroid/view/inputmethod/ExtractedText;

    move-result-object v4

    .line 134
    .local v4, tex:Landroid/view/inputmethod/ExtractedText;
    const-string v0, ""

    .line 135
    .local v0, currentText:Ljava/lang/String;
    const/4 v1, 0x0

    .line 136
    .local v1, cursorPosition:I
    if-eqz v4, :cond_3

    .line 137
    iget-object v5, v4, Landroid/view/inputmethod/ExtractedText;->text:Ljava/lang/CharSequence;

    if-eqz v5, :cond_2

    .line 138
    iget-object v5, v4, Landroid/view/inputmethod/ExtractedText;->text:Ljava/lang/CharSequence;

    invoke-virtual {v5}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v0

    .line 140
    :cond_2
    iget v1, v4, Landroid/view/inputmethod/ExtractedText;->selectionStart:I

    .line 145
    :cond_3
    const-string v5, "com.vlingo.client.actions.RECOGNIZE.field_id"

    const-string v6, "vp_main"

    invoke-virtual {v2, v5, v6}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 146
    if-eqz v3, :cond_4

    .line 148
    const-string v5, "com.vlingo.client.actions.RECOGNIZE.field_context"

    invoke-virtual {v2, v5, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 150
    :cond_4
    if-eqz v0, :cond_5

    .line 152
    const-string v5, "com.vlingo.client.actions.RECOGNIZE.cur_text"

    invoke-virtual {v2, v5, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 155
    :cond_5
    const-string v5, "com.vlingo.client.actions.RECOGNIZE.cursor_pos"

    invoke-virtual {v2, v5, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

    .line 158
    :try_start_0
    iget-object v5, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->mService:Lcom/vlingo/client/asr/service/IVLRecognitionService;

    iget-object v6, p0, Lcom/android/inputmethod/latin/VlingoVoiceManager;->m_recListener:Lcom/vlingo/client/asr/service/IVLRecognitionListener;

    invoke-interface {v5, v2, v6}, Lcom/vlingo/client/asr/service/IVLRecognitionService;->startListening(Landroid/content/Intent;Lcom/vlingo/client/asr/service/IVLRecognitionListener;)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 160
    :catch_0
    move-exception v5

    goto :goto_0
.end method
